package com.up.upzl.biz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.up.upzl.base.service.impl.BaseServiceImpl;
import com.up.upzl.biz.domain.ShopBusinessType;
import com.up.upzl.biz.repository.ShopBusinessTypeRepository;
import com.up.upzl.biz.service.ShopBusinessTypeService;

@Service
public class ShopBusinessTypeServiceImpl extends BaseServiceImpl<ShopBusinessType, Long>
		implements ShopBusinessTypeService {

	@Autowired
	private ShopBusinessTypeRepository shopBusinessTypeRepository;

	@Override
	public Page<ShopBusinessType> findByNameLike(String name, Pageable page) {
		return shopBusinessTypeRepository.findByNameLike("%" + name + "%", page);
	}

	@Override
	public ShopBusinessType findByName(String name) {
		return shopBusinessTypeRepository.findByName(name);
	}

	@Override
	public List<ShopBusinessType> findByPid(Long pid) {
		return shopBusinessTypeRepository.findByParentShopBusinessTypeId(pid);
	}
}
